package com.yanqu.road.logic.pb;

import com.yanqu.road.entity.activity.xiuxian.data.CrossXiuXianPvpUserData;
import com.yanqu.road.entity.activity.xiuxian.data.XiuXianPveSampleData;
import com.yanqu.road.entity.activity.xiuxian.data.XiuXianUserData;
import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.pb.activity.XiuXianProto;

public class CrossXiuXianPb {

    public static XiuXianProto.XiuXianPveSampleTemp.Builder parsePveSampleTemp(UserBaseInfo userBaseInfo, XiuXianUserData xiuXianUserData){
        XiuXianProto.XiuXianPveSampleTemp.Builder builder = XiuXianProto.XiuXianPveSampleTemp.newBuilder();
        builder.setName(userBaseInfo.getNickName());
        builder.setServerId(userBaseInfo.getServerId());
        builder.setUserId(xiuXianUserData.getUserId());
        builder.setImageId(xiuXianUserData.getImageId());
        builder.setStateId(xiuXianUserData.getStateId());
        builder.setPracticeSpeed(xiuXianUserData.getPracticeSpeed());
        builder.setSectId(xiuXianUserData.getSectId());
        return builder;
    }

    public static XiuXianProto.XiuXianPveSampleTemp.Builder parsePveSampleTemp(XiuXianPveSampleData sampleData){
        XiuXianProto.XiuXianPveSampleTemp.Builder builder = XiuXianProto.XiuXianPveSampleTemp.newBuilder();
        builder.setName(sampleData.getName());
        builder.setServerId(sampleData.getServerId());
        builder.setUserId(sampleData.getUserId());
        builder.setImageId(sampleData.getImageId());
        builder.setStateId(sampleData.getStateId());
        builder.setPracticeSpeed(sampleData.getPracticeSpeed());
        builder.setSectId(sampleData.getSectId());
        return builder;
    }

    public static XiuXianPveSampleData parseToPveSampleData(XiuXianProto.XiuXianPveSampleTemp msg){
        XiuXianPveSampleData sampleData = new XiuXianPveSampleData();
        sampleData.setServerId(msg.getServerId());
        sampleData.setUserId(msg.getUserId());
        sampleData.setImageId(msg.getImageId());
        sampleData.setName(msg.getName());
        sampleData.setStateId(msg.getStateId());
        sampleData.setPracticeSpeed(msg.getPracticeSpeed());
        sampleData.setSectId(msg.getSectId());
        return sampleData;
    }

    public static XiuXianProto.XiuXianPveSampleTemp.Builder parsePveSampleTemp(UserBaseInfo userBaseInfo, CrossXiuXianPvpUserData xiuXianUserData){
        XiuXianProto.XiuXianPveSampleTemp.Builder builder = XiuXianProto.XiuXianPveSampleTemp.newBuilder();
        builder.setName(userBaseInfo.getNickName());
        builder.setServerId(userBaseInfo.getServerId());
        builder.setUserId(xiuXianUserData.getUserId());
        builder.setImageId(xiuXianUserData.getPveProperty().getImageId());
        builder.setStateId(xiuXianUserData.getPveProperty().getStateId());
        builder.setPracticeSpeed(xiuXianUserData.getPveProperty().getPracticeSpeed());
        builder.setSectId(xiuXianUserData.getCampId());
        return builder;
    }
}
